package com.dlc.shop.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dlc.shop.bean.model.WarehouseArea;
import com.dlc.shop.common.util.PageParam;
import com.dlc.shop.dao.WarehouseAreaMapper;
import com.dlc.shop.service.WarehouseAreaService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 仓库项和供货城市关联信息
 *
 * @author FrozenWatermelon
 * @date 2023-11-08 11:11:44
 */
@Service
@AllArgsConstructor
public class WarehouseAreaServiceImpl  extends ServiceImpl<WarehouseAreaMapper, WarehouseArea> implements WarehouseAreaService {

    private final WarehouseAreaMapper warehouseAreaMapper;


    @Override
    public IPage<WarehouseArea> page(PageParam pageDTO) {
        return warehouseAreaMapper.list(pageDTO);
    }

    @Override
    public WarehouseArea getByWarehouseAreaId(Long warehouseAreaId) {
        return warehouseAreaMapper.getByWarehouseAreaId(warehouseAreaId);
    }

    @Override
    public void update(WarehouseArea warehouseArea) {
        warehouseAreaMapper.update(warehouseArea);
    }

    @Override
    public void deleteById(Long warehouseAreaId) {
        warehouseAreaMapper.deleteById(warehouseAreaId);
    }


    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteByWarehouseId(Long warehouseId) {
        warehouseAreaMapper.deleteByWarehouseId(warehouseId);
    }
}
